// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   AnytableAction.java

package com.vandagroup.common.util.anytable;

import com.vandagroup.common.bo.UserContext;
import com.vandagroup.common.webapp.ActiveAction;
import com.vandagroup.common.webapp.ResourceReader;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts.action.*;

// Referenced classes of package com.vandagroup.common.util.anytable:
//            AnytableBO, AnytableFormBean

public class AnytableAction extends ActiveAction
{

    public AnytableAction()
    {
    }

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, UserContext user)
        throws Exception
    {
        String strPageNO = request.getParameter("pageNO");
        int pageNO = strPageNO == null ? Integer.parseInt("1") : Integer.parseInt(strPageNO);
        try
        {
            AnytableBO bo = new AnytableBO();
            AnytableFormBean bean = (AnytableFormBean)form;
            bean.setKeyValue(request.getParameter(bean.getKey().toLowerCase()));
            bo.setUser(user);
            com.vandagroup.common.util.Result t = bo.query(pageNO, bean);
            request.setAttribute("result", t);
            request.setAttribute("form", bean);
            return mapping.findForward("list");
        }
        catch(Exception e)
        {
            ActiveAction.log.error("Exception:", e);
            return forwardErrorPage(request, mapping, ResourceReader.getMessageFromResource("error.common.util.anytable.search"), e);
        }
    }
}
